Skip to content

Conversation

@itsmeichigo
Copy link
Contributor

@itsmeichigo itsmeichigo commented Sep 5, 2025

Closes WOOMOB-1279

Description

There are recently a few crashes on the watch app in version 23.0, the crashlog indicates an assertion failure in DefaultRequestAuthenticator.generateApplicationPassword(). In DefaultApplicationPasswordUseCase, we do have a fatalError when the app attempts to generate password from the watch, assuming this doesn't happen because the watch should be able to pick up the app password from the keychain after it was created upon iOS app login. The crash on 23.0 therefore is quite hard to reproduce.

When trying the app on 23.2, the watch app crashes 100% when logging in to the app with site credentials. In this version, I moved the creation of app name to the initializer of DefaultApplicationPasswordUseCase to help with unit tests. This causes the watch app to crash whenever AlamofireNetwork is initalized.

This PR addresses the crash by properly getting the model name from WatchKit. This is used to set as the name for the app password if generating a password from the watch app is needed.

Testing steps

  • Log in to the iOS app with site credentials. Ensure to go through the credentials-only path, not the web view path. If you're shown the web view, proceed to log in then log out and try again.
  • Once login succeeds, open the watch app. Confirm that the app doesn't crash upon launch and the order list is loaded successfully.

Testing information

Tested with both simulator (debug build) and physical devices (alpha build).

Screenshots

N/A


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@itsmeichigo itsmeichigo added this to the 23.2 ❄️ milestone Sep 5, 2025
@dangermattic
Copy link
Collaborator

dangermattic commented Sep 5, 2025

1 Warning
⚠️ This PR is assigned to the milestone 23.2 ❄️. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr16094-8a78a70
Version23.2
Bundle IDcom.automattic.alpha.woocommerce
Commit8a78a70
Installation URL1gavccagj70sg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@itsmeichigo itsmeichigo marked this pull request as ready for review September 5, 2025 10:10
Copy link
Contributor

@RafaelKayumov RafaelKayumov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code wise looks good.
I wasn't able to test with the "store credentials only" path. I was re-directed to a web view to re-enter credentials and then approve the connection. I logged out and relogged in but also had to approve connection again in the web view.
What should I change on my stie/user to have the correct "store credentials only" route?

@itsmeichigo
Copy link
Contributor Author

I wasn't able to test with the "store credentials only" path. I was re-directed to a web view to re-enter credentials and then approve the connection. I logged out and relogged in but also had to approve connection again in the web view.
What should I change on my stie/user to have the correct "store credentials only" route?

@RafaelKayumov You can try with a Jurassic Ninja site as sites with security plugins may block the native login path entirely. Let me know if you need more help with testing, I can invite you to my test site.

Copy link
Contributor

@RafaelKayumov RafaelKayumov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with Jurassic ninja site - was able to execute the right path. Watch app running without a crash.

Just a question - should the watch app generated app password (...watch-app-client...) be visible in site wp-admin in users section?

@itsmeichigo
Copy link
Contributor Author

Just a question - should the watch app generated app password (...watch-app-client...) be visible in site wp-admin in users section?

@RafaelKayumov In most cases the watch doesn't generate password by itself, because by the time the credentials are synced from the iOS app, the app password is already available through the keychain after logging in.

The app name creation used to be a lazy var, but I moved it to the initializer to help with unit tests. So now we create an app name for the watch, but it's not always used. I'm still unsure about the path where the watch needs to generate password itself, but it does happen, which caused the crash in 23.0.

@itsmeichigo itsmeichigo merged commit 04aea80 into release/23.2 Sep 8, 2025
25 checks passed
@itsmeichigo itsmeichigo deleted the woomob-1279-watchos-crash branch September 8, 2025 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants